﻿using Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Web.Class;
using YXYLCommon;

namespace Web.Pages.YongShui._15.BaoBiaoGL
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.WebReport1.Prepare();
            }
        }

        protected void WebReport1_StartReport(object sender, EventArgs e)
        {
            List<BaoBiaoCS> csList = new DALBaoBiaoCS().GetByBaoBiaoId(31);
            //实例化报表
            MyReportWeb myreport = new MyReportWeb(eReportOpenType.Preview, csList, null, this.WebReport1);
            //初始化报表
            DbCmdResult rs = myreport.Init(31, "", LoginInfo.CurrentUser.UserID.ToString());
            if (!rs.IsSuccess)
            {
                PageTools.AlertMsg(this, rs.ReturnMsg);
                return;
            }
            //加载模版
            rs = myreport.LoadTemplate();
            if (!rs.IsSuccess)
            {
                PageTools.AlertMsg(this, rs.ReturnMsg);
                return;
            }
            //加载数据
            rs = myreport.LoadData();
            if (!rs.IsSuccess)
            {
                PageTools.AlertMsg(this, rs.ReturnMsg);
                return;
            }
        }
    }
}